<?php
/**
 *	description:ZMAXWECHAT 图文消息队列控制器
 *  author：min.zhang
 *  Email:zhang19min88@163.com
 *	Url:http://www.zmax99.com
 *  copyright:南宁市程序人软件科技有限责任公司保留所有权利
 *  date:2016-05-01
 *  @license GNU General Public License version 3, or later
 *  check date:2016-05-26
 *  checker:min.zhang
 */
defined('_JEXEC') or die('You can not access this file!');
jimport('joomla.application.component.controlleradmin');


class zmaxwechatControllerNewsqueues extends JControllerAdmin
 {
	 public function getModel($name = 'newsqueue' ,$prefix = 'zmaxwechatModel' ,$config = array())
	 {
		return parent::getModel($name , $prefix ,$config);
	 }
	 
	 
	 public function wechat()
	 {
		$ids = JFactory::getApplication()->input->get("cid",NULL ,"ARRAY");
		$model = $this->getModel();
		if($model->wechat($ids))
		{
			$nCount = count($ids);
			$msg="你已经成功的将".$nCount."篇文章发布到了微信";
			$type="notice";
		}
		else
		{
			$msg = $model->getError();
			$type="error";
		}
		$this->setRedirect("index.php?option=com_zmaxwechat&view=newsqueues",$msg,$type);
	 }
	 
	 public function ajaxDelete()
	 {
		 $app = JFactory::getApplication();
		 $newsId = $app->input->get('id' ,'','INT');
		 $db = JFactory::getDBO();
		 $query = "DELETE FROM #__zmaxwechat_newsqueue WHERE id=".$newsId;
		 $db->setQuery($query);
		 $db->query();
		 $app->close();
	 }
	 
	 
 }	
	

?>